<?php
session_start();
require 'database/photo_handler.php';
    if (isset($_SESSION['Username']) && isset($_SESSION['Password'])){
        header('Location: homepage.php');
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Flickertiew&trade;</title>
	<script type="text/javascript" src="script/validator.js"></script>
	<script type="text/javascript" src="script/calendar.js"></script>
        <script type="text/javascript" src="script/ajax.js"></script>
	<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
    <link rel="stylesheet" href="style/style.css" />
</head>
<body onload="HideCalendar(); reloadPhotos();" >
    <?php
       if ($_GET['gagal'] == 1){
           ?>
            <script type="text/javascript">alert("Login failed");</script>
           <?
       }

       if ($_GET['reg']==1){
           ?>
            <script type="text/javascript">alert("Registration is Successfull");</script>
           <?
       }
    ?>
    <div id="container">
	<div id="headerBody">
     <form id="Search" name="Search" method ="GET" action="search_result.php">
        <input type="text" id="SearchBar" name="SearchBar"/>
        <input type="submit" id="SearchOk" name="SearchOk" value="Search"/>
    </form>
    </div>
	<div id=""><img src="images/flickertiew_logo.gif" alt=""/></div>
	<div id="menuLogin">
        	<table id="TableLogin">
            <tr>
            <td>
        	<form method="POST" class="Login" id="Login" action = "database/login.php">
            <label id="LabelUserNameLogin"> UserName</label> <span id="UserNameLoginSpan"> : </span> <input type="text" id="UserNameLogin" name="UserNameLogin"/> <label class="Peringatan" id="LabelUserNameLoginSalah"> </label>
            <label id="LabelPasswordLogin"> Password</label> <span id="PasswordLoginSpan"> : </span> <input type="password" id="PasswordLogin" name="PasswordLogin"/> <label class="Peringatan" id="LabelPasswordLoginSalah"> </label>
            <input type="submit" id="LoginButton" name="LoginButton" value="Login"/>
            </form>
            </td>
            </tr>
            </table>
        </div>
	

      <div id="fb-root"></div>
      
      <script>
		 function CekRegis(Masukan,UserName,Password,PasswordB,Nama,Tanggal,Lokasi,Hobi,Photo,aa,bb,cc,dd,ee,ff,gg,hh)
		 {
		 if(CekRegistrasi (UserName,Password,PasswordB,Nama,Tanggal,Lokasi,Hobi,Photo,aa,bb,cc,dd,ee,ff,gg,hh) == true) // berhasil registrasi
			{
				if(document.forms[2].Cek[0].checked == true)
				{
				 //tampilkan wallpost
				 FB.init({ 
					appId:'155435634517036', cookie:true, 
					status:true, xfbml:true 
				 });

				 FB.ui({ method: 'feed', 
					message: Masukan});
				}
				return true;
			}
		 return false;
		}
      </script>
 
	<div id="content">
        	<div id="Form_registrasi" name="Form_registrasi" class="group_content">
        	<form enctype="multipart/form-data" class="Registrasi" id = "Registrasi" name = "Registrasi" method="POST" action="database/register.php" onsubmit='var a = FirstName.value + " "+LastName.value; var b = a+" sudah pakai flickertiew, bagaimana dengan kamu?";return CekRegis(b,UserName.value,Password.value,Password2.value,a,Birthday.value,Location.value,Hobby.value,UserPhoto.value,LabelFullNameSalah,LabelUserNameSalah,LabelPasswordSalah,LabelPassword2Salah,LabelBirthdaySalah,LabelLocationSalah,LabelHobbySalah,LabelUserPhotoSalah);'>
            <div id="_title">Sign Up</div><br/>
			<div class="ulabeler2" id ="LabelUserPhoto">Photo</div><input type="file" id="UserPhoto" name="UserPhoto"/> <label class="Peringatan" id="LabelUserPhotoSalah"> </label>
			<br /><br />
			<div class="ulabeler2" id="LabelUserName">User Name (Email)</div><input type="text" class="textarea3" id="UserName" name="UserName"/> <label class="Peringatan" id="LabelUserNameSalah"> </label>
            <br />
            <div class="ulabeler2" id="LabelPassword">Password</div><input type="password" class="textarea3" id="Password" name="Password"/> <label class="Peringatan" id="LabelPasswordSalah"> </label>
            <br />
            <div class="ulabeler2" id="LabelPassword2"> Password (Retype)</div><input type="password" class="textarea3" id="Password2" name="Password2"/> <label class="Peringatan" id="LabelPassword2Salah"> </label>
            <br />
            <div class="ulabeler2" id="LabelUserFirstName">First Name</div><input type="text" class="textarea3" id="FirstName" name="FirstName"/><br/>
            <div class="ulabeler2" id="LabelUserLastName">Last Name</div><input type="text" class="textarea3" id="LastName" name="LastName"/> <label class="Peringatan" id="LabelFullNameSalah"> </label>
            <br />
            <div class="ulabeler2" id="LabelBirthday"> Birthday</div><input type="text" class="textarea3" id="Birthday" name="Birthday"/> <img alt="" src = "script/calendar.jpg" id = "IconCalendar"  onclick = "toggleCalendar('Birthday')" /><label class="Peringatan" id="LabelBirthdaySalah" style="margin-left:37px;"> </label>
			<br />
			<table border="1" cellpadding="0" cellspacing="3" id="calendar">
              <tbody>
              <tr>
                <td class="today" colspan="5" id="todayday" onclick="">This is calendar popup</td>
                <td align="right" colspan="2"><a href="javascript:HideCalendar();"><b>Hide</b></a></td>
              </tr>
              <tr>
                <td colspan="7" valign="middle">
                <!-- Month combo box -->
                <select id="month" onchange="newCalendar()">
                    <option value="Januari">January</option>
                    <option value="Februari">February</option>
                    <option value="Maret">March</option>
                    <option value="April">April</option>
                    <option value="Mei">May</option>
                    <option value="Juni">June</option>
                    <option value="Juli">July</option>
                    <option value="Agustus">August</option>
                    <option value="September">September</option>
                    <option value="Oktober">October</option>
                    <option value="November">November</option>
                    <option value="Desember">December</option>
                </select>
                <!-- Year combo box -->
                <select id="year" onchange="newCalendar()">
                    <option value="1951">1951</option>
                    <option value="1952">1952</option>
                    <option value="1953">1953</option>
                    <option value="1954">1954</option>
                    <option value="1955">1955</option>
                    <option value="1956">1956</option>
                    <option value="1957">1957</option>
                    <option value="1958">1958</option>
                    <option value="1959">1959</option>
                    <option value="1950">1960</option>

                    <option value="1961">1961</option>
                    <option value="1962">1962</option>
                    <option value="1963">1963</option>
                    <option value="1964">1964</option>
                    <option value="1965">1965</option>
                    <option value="1966">1966</option>
                    <option value="1967">1967</option>
                    <option value="1968">1968</option>
                    <option value="1969">1969</option>
                    <option value="1970">1970</option>

                    <option value="1971">1971</option>
                    <option value="1972">1972</option>
                    <option value="1973">1973</option>
                    <option value="1974">1974</option>
                    <option value="1975">1975</option>
                    <option value="1976">1976</option>
                    <option value="1977">1977</option>
                    <option value="1978">1978</option>
                    <option value="1979">1979</option>
                    <option value="1980">1980</option>

                    <option value="1981">1981</option>
                    <option value="1982">1982</option>
                    <option value="1983">1983</option>
                    <option value="1984">1984</option>
                    <option value="1985">1985</option>
                    <option value="1986">1986</option>
                    <option value="1987">1987</option>
                    <option value="1988">1988</option>
                    <option value="1989">1989</option>
                    <option value="1990">1990</option>

                    <option value="1991">1991</option>
                    <option value="1992">1992</option>
                    <option value="1993">1993</option>
                    <option value="1994">1994</option>
                    <option value="1995">1995</option>
                    <option value="1996">1996</option>
                    <option value="1997">1997</option>
                    <option value="1998">1998</option>
                    <option value="1999">1999</option>
                    <option value="2000">2000</option>

                    <option value="2001">2001</option>
                    <option value="2002">2002</option>
                    <option value="2003">2003</option>
                    <option value="2004">2004</option>
                    <option value="2005">2005</option>
                    <option value="2006">2006</option>
                    <option value="2007">2007</option>
                    <option value="2008">2008</option>
                    <option value="2009">2009</option>
                    <option value="2010">2010</option>
                    <option value="2011">2011</option>
                </select>

                </td>
              </tr>
              <tr class="days">
                <!-- Generate column for each day. -->
                <td>Sunday</td>
                <td>Monday</td>
                <td>Tuesday</td>
                <td>Wednesday</td>
                <td>Thursday</td>
                <td>Friday</td>
                <td>Saturday</td>
              </tr>
              </tbody>

              <!-- Generate today day. -->
              <tbody class="dates" id="dayList" onclick="getDate('')" valign="middle">
              <!-- Generate grid for individual days. -->
              <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
              <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
              <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
              <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
              <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
              <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
                </tbody>

            </table>



            <br />
           <div class="ulabeler2" id="LabelLocation">Location</div><input type="text" class="textarea3" id="Location" name="Location"/> <label class="Peringatan" id="LabelLocationSalah"> </label>
           <br />
           <div class="ulabeler2" id="LabelHobby">Hobby</div><input type="text" class="textarea3" id="Hobby" name="Hobby"/> <label class="Peringatan" id="LabelHobbySalah"> </label>
           <br />
		   <div class="ulabeler2" id="LabelCek">Ingin ditampilkan di Facebook?</div><input type="radio" id="Cek" name="Cek" value="ya" checked="checked"/> <label> Ya </label> <input type="radio" id="Cek" name="Cek" value="tidak"/> <label> Tidak </label>
           <br />
           <input type="submit" id="SubmitRegistrasi"  name="SubmitRegistrasi" value="Submit"/>
            </form>
			</div>
   	 	</div>
	
    <div id="centerBody">
    	
        
        <div id="photophoto"></div>
		
	</div>
    <div id="footerBody">
    	<div id="footer" align="center">
                        Copyright &copy; 2011<br/>
                        Created by <a href="http://www.facebook.com/Gunawan.Robert" id="headerLink">Robert Gunawan</a>
						, <a href="http://www.facebook.com/danz3m" id="headerLink">Danang Tri Massandy</a>, 
						<a href="http://www.facebook.com/achmad.giovani" id="headerLink">Achmad Giovani</a>
                    </div>
    </div>
</div>


</body>
</html>
